package com.baicaoyuan.web.enums;


import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;

@RequiredArgsConstructor
@Getter
public enum StatusEnum {

    /**
     * 正常
     */
    NORMAL("1"),
    /**
     * 删除
     */
    DELETE("9");
    private final String status;

    /**
     * 根据标识获取枚举
     *
     * @param projectStatus
     * @return
     */
    public static StatusEnum acquire(final String projectStatus) {
        Optional<StatusEnum> statusEnum = Arrays.stream(StatusEnum.values())
                .filter(s -> (Objects.equals(s.getStatus(), projectStatus)))
                .findFirst();
        return statusEnum.orElse(StatusEnum.NORMAL);
    }
}

